package com.dimanche.library_base.module;

import android.app.Application;

import com.alibaba.android.arouter.launcher.ARouter;
import com.dimanche.library_base.BuildConfig;
import com.dimanche.library_base.utils.AppUtils;
import com.dimanche.library_base.utils.LogUtils;
import com.hjq.toast.ToastUtils;

/**
 * author : Dimanche
 * date   : 2021/3/5 14:10
 * desc   :基础库初始化
 * version: 1.0
 */
public class BaseModuleInit implements IModuleInit {
    private final static String TAG = BaseModuleInit.class.getPackage().getName();

    @Override
    public boolean onInitAhead(Application application) {
        LogUtils.logi(TAG, "基础库初始化====onInitAhead");
        AppUtils.setApplication(application);
        //初始化阿里路由框架
        if (BuildConfig.DEBUG) {
            ARouter.openLog();     // 打印日志
            ARouter.openDebug();   // 开启调试模式(如果在InstantRun模式下运行，必须开启调试模式！线上版本需要关闭,否则有安全风险)
        }
        ARouter.init(application); // 尽可能早，推荐在Application中初始化
        //Toast框架，兼容android11
        ToastUtils.init(application);
        return false;
    }

    @Override
    public boolean onInitLow(Application application) {
        LogUtils.logi(TAG, "基础库初始化====onInitLow");
        return false;
    }
}
